package njci.softerware.com.myexpress2017.fragement;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.github.mikephil.charting.utils.Utils;
import com.phillipcalvin.iconbutton.IconButton;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import njci.softerware.com.myexpress2017.R;
import njci.softerware.com.myexpress2017.chart.PieChartActivity;
import njci.softerware.com.myexpress2017.utils.Constant;


public class KuAidi extends Fragment {
    @Bind(R.id.day_button)
    IconButton day_button;
    @Bind(R.id.search_week)
    IconButton searchWeek;
    @Bind(R.id.search_month)
    IconButton searchMonth;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_ku_aidi, container, false);
        ButterKnife.bind(this, view);
        return view;
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @OnClick({R.id.day_button, R.id.search_week, R.id.search_month})
    public void onClick(View view) {
        int searchTyp = -1;
        switch (view.getId()) {
            case R.id.day_button:
                searchTyp= Constant.search_day;
                break;
            case R.id.search_week:
                searchTyp= Constant.search_week;
                break;
            case R.id.search_month:
                searchTyp= Constant.search_moonth;
                break;
        }
        Intent intent = new Intent(getActivity(), PieChartActivity.class);
        intent.putExtra(Constant.searchType,searchTyp);
        startActivity(intent);
    }
}
